package com.zxmzy.scaffold.core.ext

import android.content.Context
import android.net.ConnectivityManager
import android.telephony.TelephonyManager
import android.view.inputmethod.InputMethodManager
import com.zxmzy.scaffold.core.utils.appContext

/**
 * @author zhangxiaoming
 * @date 2023/7/28
 * @description
 */
@PublishedApi
internal fun <T> getSystemService(name: String) =
    appContext.getSystemService(name).saveAsUnChecked<T>()

inline val inputMethodManager: InputMethodManager?
    get() = getSystemService(Context.INPUT_METHOD_SERVICE)

inline val connectivityManager: ConnectivityManager?
    get() = getSystemService(Context.CONNECTIVITY_SERVICE)

inline val telephonyManager: TelephonyManager?
    get() = getSystemService(Context.TELEPHONY_SERVICE)
